﻿' A connector consists of two nodes and a connection type. A connection has a
' filtered state. The opacity is reduced when drawing a connection that is 
' filtered. An animation is applied to the brush when the filtered state changes.

Imports System
Imports System.Windows
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Globalization

Public Class ChildDiagramConnector
    Inherits DiagramConnector

    Public Sub New(ByVal startConnector As DiagramConnectorNode, ByVal endConnector As DiagramConnectorNode)
        MyBase.New(startConnector, endConnector)
        ' Get the pen that is used to draw the connection line.
        Me.ResourcePen = CType(Application.Current.TryFindResource("ChildConnectionPen"), Windows.Media.Pen)
    End Sub

    ''' <summary>
    ''' Draw the connection between the two nodes.
    ''' </summary>
    <System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods")> _
     Public Overrides Function Draw(ByVal drawingContext As DrawingContext) As Boolean
        If Not MyBase.Draw(drawingContext) Then
            Return False
        End If
        drawingContext.DrawLine(Me.Pen, Me.StartNode.Center, Me.EndNode.Center)
        Return True
    End Function

End Class
